/*  1:   */ package com.atomikos.icatch.imp;
/*  2:   */ 
/*  3:   */ import com.atomikos.icatch.imp.thread.TaskManager;
/*  4:   */ import com.atomikos.icatch.system.Configuration;
/*  5:   */ 
/*  6:   */ class Propagator
/*  7:   */ {
/*  8:40 */   static long RETRY_INTERVAL = 10000L;
/*  9:44 */   private boolean threaded_ = true;
/* 10:   */   
/* 11:   */   Propagator(boolean threaded)
/* 12:   */   {
/* 13:50 */     this.threaded_ = threaded;
/* 14:   */   }
/* 15:   */   
/* 16:   */   public synchronized void submitPropagationMessage(PropagationMessage msg)
/* 17:   */   {
/* 18:62 */     PropagatorThread t = new PropagatorThread(msg);
/* 19:63 */     if (this.threaded_) {
/* 20:64 */       TaskManager.getInstance().executeTask(t);
/* 21:   */     } else {
/* 22:66 */       t.run();
/* 23:   */     }
/* 24:   */   }
/* 25:   */   
/* 26:   */   private static class PropagatorThread
/* 27:   */     implements Runnable
/* 28:   */   {
/* 29:   */     private PropagationMessage msg;
/* 30:   */     
/* 31:   */     PropagatorThread(PropagationMessage msg)
/* 32:   */     {
/* 33:79 */       this.msg = msg;
/* 34:   */     }
/* 35:   */     
/* 36:   */     public void run()
/* 37:   */     {
/* 38:   */       try
/* 39:   */       {
/* 40:85 */         boolean tryAgain = true;
/* 41:   */         do
/* 42:   */         {
/* 43:87 */           tryAgain = this.msg.submit();
/* 44:88 */           if (tryAgain)
/* 45:   */           {
/* 46:90 */             Thread.sleep(Propagator.RETRY_INTERVAL);
/* 47:91 */             if (Configuration.isDebugLoggingEnabled()) {
/* 48:91 */               Configuration.logDebug("Propagator: retrying message: " + this.msg);
/* 49:   */             }
/* 50:   */           }
/* 51:94 */         } while (tryAgain);
/* 52:   */       }
/* 53:   */       catch (Exception e)
/* 54:   */       {
/* 55:97 */         Configuration.logWarning("ERROR in propagator: " + e.getMessage() + (this.msg != null ? " while sending message: " + this.msg : ""), e);
/* 56:   */       }
/* 57:   */     }
/* 58:   */   }
/* 59:   */ }


/* Location:           C:\myfile\mysoft\apache-maven-3.5.0-bin\apache-maven-3.5.0\myrep\com\atomikos\transactions\3.7.0\transactions-3.7.0.jar
 * Qualified Name:     com.atomikos.icatch.imp.Propagator
 * JD-Core Version:    0.7.0.1
 */